<template>
	<view class="page">
		<view class="top">
			<view class="background"></view>
		</view>
		<view class="user-card">
			<view class="card">
				<view class="top">
					<view class="userImage">
						<open-data type="userAvatarUrl"></open-data>
					</view>
				</view>
				<view class="bottom">
					<view class="left">
						<view class="user-text">
							<open-data type="userNickName"></open-data>
						</view>
						<view class="user-phone">AI面试官</view>
					</view>
					<view class="right flex-center">
						<u-icon class="icon" name="arrow-right"></u-icon>
					</view>
				</view>
			</view>
		</view>
		<view class="list-card">
			<view class="card">
				<view class="item item-bottom-solid" hover-class="hover-view" @click="itemClick('records')">
					<view class="left flex-center">
						<image src="http://img.itboyhub.com/2024/mp/history_record.png" mode="aspectFit"></image>
					</view>
					<view class="center">
						<text>面试记录</text>
					</view>
					<view class="right flex-center">
						<u-icon class="icon" name="arrow-right"></u-icon>
					</view>
				</view>
			</view>
			<view class="card">
				<view class="item item-bottom-solid" hover-class="hover-view" @click="itemClick('about')">
					<view class="left flex-center">
						<image src="http://img.itboyhub.com/2024/mp/about_me.png" mode="aspectFit"></image>
					</view>
					<view class="center">
						<text>关于</text>
					</view>
					<view class="right flex-center">
						<u-icon class="icon" name="arrow-right"></u-icon>
					</view>
				</view>
			</view>
		</view>
		<uni-popup ref="aboutDialog" type="dialog">
			<uni-popup-dialog type="success" cancelText="关闭" confirmText="了解" title="关于">
				<view>
					<view>
						<uni-tag text="版本" :inverted="true" type="primary"></uni-tag>
						<text style="font-size: 12px;color: gray;margin-left: 10px;">v0.0.1</text>
					</view>
					<view style="margin-top:8px">
						<uni-tag text="开发者" :inverted="true" type="warning"></uni-tag>
						<text style="font-size: 12px;color: gray;margin-left: 10px;"> javaboy</text>
					</view>
					<view style="margin-top:8px">
						<uni-tag text="联系方式" :inverted="true" type="success"></uni-tag>
						<text style="font-size: 12px;color: gray;margin-left: 10px;">+V a_java_boy</text>
					</view>
				</view>
			</uni-popup-dialog>
		</uni-popup>
	</view>
</template>
<style lang="scss" scoped>
	.hover-view {
		background-color: gainsboro;
		color: whitesmoke;
	}

	.top {
		height: 250rpx;
		position: relative;

		.background {
			background-color: #5199ff;
			border-bottom-left-radius: 22px;
			border-bottom-right-radius: 22px;
			position: absolute;
			height: 360rpx;
			width: 100%;
		}
	}

	.icon {
		color: #96a1ae;
		font-size: 20rpx;
	}

	.user-card {
		height: 170rpx;
		padding: 0 15px;
		margin-top: 40px;

		.card {
			position: relative;
			bottom: 62px;
			height: 250rpx;
			background-color: white;
			border-radius: 5px;

			.top {
				height: 30%;
				position: relative;

				.userImage {
					position: absolute;
					bottom: 24%;
					left: 10%;
					width: 150rpx;
					height: 150rpx;
					overflow: hidden;
					border-radius: 50%;
					border: 2px solid white;
				}
			}

			.bottom {
				display: flex;
				height: 70%;

				.left {
					width: 80%;
					height: 100%;
					position: relative;

					.user-text {
						width: 100%;
						padding-left: 80rpx;
						height: 50%;
					}

					.user-phone {
						color: #96a1ae;
						padding-left: 80rpx;
						height: 50%;
						width: 100%;
						font-size: 0.9em;
					}
				}

				.right {
					width: 20%;
					height: 50%;
				}
			}
		}
	}

	.list-card {
		padding: 0 15px;

		.card {
			border-radius: 5px;
			position: relative;
			background-color: white;
			border-radius: 5px;
			padding: 0px 30px;

			.item {
				display: flex;
				height: 120rpx;

				.left {
					width: 15%;

					image {
						width: 70rpx;
						height: 70rpx;
					}
				}

				.center {
					width: 65%;
					display: flex;
					justify-content: start;
					align-items: center;
				}

				.right {
					width: 20%;
					justify-content: flex-end;
				}
			}
		}
	}

	.item-bottom-solid {
		border-bottom: 1px solid #d4d6da;
	}

	.quit {
		height: 100rpx;
		margin-top: 50px;

		.btn {
			background-color: #4f99ff;
			border-radius: 30px;
			width: 80%;
			color: white;
			font-size: 1.2em;
			height: 100%;
		}
	}

	.flex-center {
		display: flex;
		justify-content: center;
		align-items: center;
	}
</style>

<script setup>
	import {
		ref,
		getCurrentInstance
	} from 'vue';
	const {
		proxy
	} = getCurrentInstance()
	let aboutDialog = ref(null)

	function itemClick(item) {
		if (item == 'about') {
			proxy.$refs.aboutDialog.open()
		} else if (item == 'records') {
			uni.navigateTo({
				url: '/pages/records/records'
			})
		}
	}
</script>